<?php
namespace App\Models\Store;
use App\Libs\Base\Constant;
class StoreType extends \App\Libs\Base\BaseModel
{
    protected $__TABLE__ = 't_paile_store_type';
	
	/**
	*	跳过检测了
	*/
	public function beforeValidation()
	{
	  //self::skipValidation([] , $this );
	}

	/**
	*	获取分类信息
	*/
    public static function gStoreType()
    {
        $types = self::findAll([
            'conditions' => 'isshow = ?1',
			'order'=>'fid',
            'bind' => [1=>'2'],
        ])->toArray();
		if( empty( $types ) ){
			return [];
		}else{
			$result = [];
			foreach( $types as $k=>$v){
					if( $v['fid'] === '0' ){
						$result[$v['id']]['fdata'][] = $v;
					}else{
						if( isset( $result[$v['fid']] ) ){
							$v['sanid'] = $v['id'];
							$result[$v['fid']]['data'][] = $v;
						}
					}
			}
		}
        return $result;
    }
	
}
